public class TestAccount{
	public static void main(String[]args){
		Bank bank = new Bank();
		Account account = bank.open("guodh", AccountType.CREDIT_ACCOUNT);
		
	}
}

class Bank{
	public Account open(String name, int type){
		Account account = null;
		if(type==AccountType.SAVING_ACCOUNT){
			account = new SavingAccount();
		}else if(type==AccountType.CREDIT_ACCOUNT){
			account = new CreditAccount();
		}else if(type==AccountType.LOAN_SAVING_ACCOUNT){
			account = new LoanSavingAccount();
		}else if(type==AccountType.LOAN_CREDIT_ACCOUNT){
			account = new LoanCreditAccount();
		}
		return account;
	}
}

class Account{}
class SavingAccount extends Account{}
class CreditAccount extends Account{}
class LoanSavingAccount extends SavingAccount{}
class LoanCreditAccount extends CreditAccount{}
/*public*/class AccountType{
	public static final int SAVING_ACCOUNT = 1;
	public static final int CREDIT_ACCOUNT = 2;
	public static final int LOAN_SAVING_ACCOUNT = 3;
	public static final int LOAN_CREDIT_ACCOUNT = 4;
}
